﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Text;

namespace IxDE
{
    class Fonts
    {
        public static void add()
        {
            PointF pointF = new PointF(10, 0);
            SolidBrush solidBrush = new SolidBrush(Color.Black);

            int count = 0;
            string familyName = "";
            string familyNameAndStyle;
            FontFamily[] fontFamilies;
            PrivateFontCollection privateFontCollection = new PrivateFontCollection();

            // Add three font files to the private collection.
            
            privateFontCollection.AddFontFile(frmSplash.start + "\\font.ttf");

            // Get the array of FontFamily objects.
            fontFamilies = privateFontCollection.Families;

            // How many objects in the fontFamilies array?
            count = fontFamilies.Length;

            // Display the name of each font family in the private collection 
            // along with the available styles for that font family. 
            for (int j = 0; j < count; ++j)
            {
                // Get the font family name.
                familyName = fontFamilies[j].Name;

                // Is the regular style available? 
                if (fontFamilies[j].IsStyleAvailable(FontStyle.Regular))
                {
                    familyNameAndStyle = "";
                    familyNameAndStyle = familyNameAndStyle + familyName;
                    familyNameAndStyle = familyNameAndStyle + " Regular";

                    Font regFont = new Font(
                       familyName,
                       16,
                       FontStyle.Regular,
                       GraphicsUnit.Pixel);
                  
                    //DrawString(familyName, regFont, solidBrush, pointF);
                   

                    pointF.Y += regFont.Height;
                }

                // Is the bold style available? 
                if (fontFamilies[j].IsStyleAvailable(FontStyle.Bold))
                {
                    familyNameAndStyle = "";
                    familyNameAndStyle = familyNameAndStyle + familyName;
                    familyNameAndStyle = familyNameAndStyle + " Bold";

                    Font boldFont = new Font(
                       familyName,
                       16,
                       FontStyle.Bold,
                       GraphicsUnit.Pixel);

                   

                    pointF.Y += boldFont.Height;
                }
                // Is the italic style available? 
                if (fontFamilies[j].IsStyleAvailable(FontStyle.Italic))
                {
                    familyNameAndStyle = "";
                    familyNameAndStyle = familyNameAndStyle + familyName;
                    familyNameAndStyle = familyNameAndStyle + " Italic";

                    Font italicFont = new Font(
                       familyName,
                       16,
                       FontStyle.Italic,
                       GraphicsUnit.Pixel);

                  

                    pointF.Y += italicFont.Height;
                }

                // Is the bold italic style available? 
                if (fontFamilies[j].IsStyleAvailable(FontStyle.Italic) &&
                fontFamilies[j].IsStyleAvailable(FontStyle.Bold))
                {
                    familyNameAndStyle = "";
                    familyNameAndStyle = familyNameAndStyle + familyName;
                    familyNameAndStyle = familyNameAndStyle + "BoldItalic";

                    Font italicFont = new Font(
                       familyName,
                       16,
                       FontStyle.Italic | FontStyle.Bold,
                       GraphicsUnit.Pixel);

                  

                    pointF.Y += italicFont.Height;
                }
                // Is the underline style available? 
                if (fontFamilies[j].IsStyleAvailable(FontStyle.Underline))
                {
                    familyNameAndStyle = "";
                    familyNameAndStyle = familyNameAndStyle + familyName;
                    familyNameAndStyle = familyNameAndStyle + " Underline";

                    Font underlineFont = new Font(
                       familyName,
                       16,
                       FontStyle.Underline,
                       GraphicsUnit.Pixel);

                

                    pointF.Y += underlineFont.Height;
                }

                // Is the strikeout style available? 
                if (fontFamilies[j].IsStyleAvailable(FontStyle.Strikeout))
                {
                    familyNameAndStyle = "";
                    familyNameAndStyle = familyNameAndStyle + familyName;
                    familyNameAndStyle = familyNameAndStyle + " Strikeout";

                    Font strikeFont = new Font(
                       familyName,
                       16,
                       FontStyle.Strikeout,
                       GraphicsUnit.Pixel);


                    pointF.Y += strikeFont.Height;
                }

                // Separate the families with white space.
                pointF.Y += 10;

            }


        }
    }
}
